import os
import pathlib
import sys

root_path = str(pathlib.Path(os.path.abspath(__file__)).parent.parent.parent)
sys.path.append(root_path)

from sklearn.cluster import MiniBatchKMeans
from config.base_config import *


def model(params, n_clusters, batch_size=1024):
    if n_clusters:
        clus = MiniBatchKMeans(n_clusters=n_clusters, batch_size=batch_size, random_state=random_state)
    else:
        best_params = params
        n_clusters = best_params['n_clusters'][0]
        # init = best_params['init']
        batch_size = best_params['batch_size'][0]
        clus = MiniBatchKMeans(n_clusters=n_clusters, batch_size=batch_size, random_state=random_state)
    return clus

# def model(n_clusters, batch_size=1024):
#     clus = MiniBatchKMeans(n_clusters=n_clusters, batch_size=batch_size, random_state=random_state)
#     return clus
